home *** CD-ROM | disk | FTP | other *** search
- Path: sn.no!usenet
- From: Jakob Rivertz <orjarive@aftenposten.no>
- Newsgroups: comp.lang.c
- Subject: Re: New C Programmer Has A Problem
- Date: 2 Feb 1996 09:17:44 GMT
- Organization: Aftenposten A/S
- Message-ID: <4eskro$m27@hasle.sn.no>
- References: <4EHPA3$6KL@NNTP.NOVIA.NET> <310fa7d2.6059545@wvnvm.wvnet.edu>
- NNTP-Posting-Host: gatekeeper.aftenposten.no
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.2N (Windows; I; 16bit)
-
- u6ed4@wvnvm.wvnet.edu (bonni mierzejewska) wrote:
- >On 29 Jan 1996 06:26:10 GMT, tsyslo@oasis.novia.net (Tony Syslo) wrote:
- >
- >> #include <clib/dos_protos.h>
- >> #include <dos/dos.h>
- >> #include <stdio.h>
- >> #include <exec/types.h>
- >
- >Hmm. If you're in MS-DOS, those '/' slashes need to be '\' slashes.
-
- It's AmigaDOS; which does use '/' characters to separate directories.
-
- BTW: MS/DOS as such can use '/' characters to separate directories. No
- MS/DOS *commands* use it though, because it would conflict with the
- command line option character. Try "fopen("c:/config.sys", "r");" on an
- MS/DOS compiler. It works.
-
- I did read the original post, and some of the responses. I think the
- actual problem with the code has been covered, and will only make a few
- general comments:
-
- The Open, Close, Read, Write, Seek, and Exit functions are part of the
- dos.library library (a DLL-like library). Open returns a BPTR to a
- (struct FileHandle). It is typedef'ed in dos/dos.h. A BPTR is a BCPL-type
- pointer to some data object. A BPTR operates on long-word boundary, ie.
- BPTR = CPTR >> 2. Never mind, BPTRs are only used internally by the
- dos.library.
-
- *Newer* use the Exit() function to terminate a program that has been
- linked with the standard C startup code. Exit() terminates your process
- imediately, preventing the startup code from closing stdin/stdout,
- freeing dynamically allocated memory, etc. Always use exit().
-
- When writing small programs like this one, always use the standard C
- stdio library functions. If your code contains a lot of non-portable
- code (eg. GUI calls), then do use the faster dos.library functions. Your
- code isn't portable anyway.
-
- --
- Jakob <orjarive@aftenposten.no>
-
-
-